package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(20);not null;comment:账号"`
	PassWord string `gorm:"type:varchar(20);not null;comment:密码"`
}
type Like struct {
	gorm.Model
	Sx string `gorm:"type:varchar(40);not null;comment:数学"`
	Yw string `gorm:"type:varchar(40);not null;comment:语文"`
	Sw string `gorm:"type:varchar(40);not null;comment:生物"`
	Dl string `gorm:"type:varchar(40);not null;comment:地理"`
}
type Add struct {
	gorm.Model
	Sx   string `gorm:"type:varchar(40);not null;comment:数学"`
	Yw   string `gorm:"type:varchar(40);not null;comment:语文"`
	Sw   string `gorm:"type:varchar(40);not null;comment:生物"`
	Dl   string `gorm:"type:varchar(40);not null;comment:地理"`
	Dz   int    `gorm:"type:int(11);not null;comment:点赞"`
	Pl   string `gorm:"type:varchar(20);not null;comment:评论"`
	Like Like
}

func (u *User) Create() error {
	return DB.Create(&u).Error
}
func (u *Like) List() error {
	return DB.Where("id = ?", u.ID).Find(&u).Error
}
func (u *Like) Add() error {
	return DB.Create(&u).Error
}
func (u *Add) Create1() error {
	return DB.Create(&u).Error
}
